import java.awt.Color;
import java.awt.Graphics;

import javax.swing.AbstractButton;
import javax.swing.JComponent;
import javax.swing.plaf.basic.BasicButtonUI;

/**
 * 最大化，最小化，关闭按钮美化
 * 
 * @author Zero
 *
 */
public class ButtonUI extends BasicButtonUI {

	// 绘制初始状态
	@Override
	public void paint(Graphics g, JComponent c) {
		g.setColor(new Color(255, 0, 0, 150));
		g.fillRoundRect(0, 0, c.getWidth(), c.getHeight(), 10, 10);
		super.paint(g, c);
	}

	// 绘制按压状态
	@Override
	protected void paintButtonPressed(Graphics g, AbstractButton b) {
		g.setColor(new Color(255, 150, 200, 150));
		g.fillRoundRect(0, 0, b.getWidth(), b.getHeight(), 10, 10);
		super.paintButtonPressed(g, b);
	}
}
